﻿<%@ Page Title="" Language="VB" MasterPageFile="~/App/Master/App.master" AutoEventWireup="false" CodeFile="Conversations.aspx.vb" Inherits="App_conversations" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CphHead" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphMainContent" runat="Server">
    <div id="send_post" style="display: none; z-index: 10000; position: absolute;">
        <div id="close_post" style="float: right; margin: 5px 10px 0px 0px; background-color: white; padding: 0px 3px 1px 3px; border-radius: 3px; font: bold 14px Tahoma,sans-serif;">X</div>

        <asp:UpdatePanel ID="UpPPost" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <App:PostWrite runat="server" ID="ppp" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <div class="row">
        <asp:UpdatePanel ID="UpPConsole" runat="server" UpdateMode="Conditional" class="span12">
            <ContentTemplate>
                <div class="wrapper">
                    <h5 class="title titolo-cassetto">Engagements</h5>
                    <span class="tips tips-3 right-top" data-tips="Tips">&nbsp;</span>

                    <div class="wrapper-inner">

                        <asp:Button runat="server" CssClass="days" ID="RbtSearchLink" Text="conversations" CommandName="GROUP_SEARCH" CommandArgument="1" Style="width: auto;" />
                        <asp:Button runat="server" CssClass="days" ID="RbtSearchCategory" Text="share" CommandName="GROUP_SEARCH" CommandArgument="2" Style="width: 70px;" />
                        <asp:Button runat="server" CssClass="days" ID="RbtSearchHashtag" Text="hashtag" CommandName="GROUP_SEARCH" CommandArgument="3" Style="width: 70px;" />
                        <asp:Button runat="server" CssClass="days" ID="RbtSearchMess" Text="message" CommandName="GROUP_SEARCH" CommandArgument="4" Style="width: auto;" />

                    </div>
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <div class="row">

        <asp:UpdatePanel ID="UpPConversations" ViewStateMode="Enabled" runat="server" UpdateMode="Conditional" class="span12">
            <ContentTemplate>
                <div class="wrapper">
                    <h5 class="title">Last update:
                        <asp:Label runat="server" ID="LblUserFound" CssClass="num-interaction" Text="" />
                    </h5>

                    <span class="tips tips-3 right-top" data-tips="Tips">&nbsp;</span>

                    <div class="wrapper-inner">
                        <asp:Timer runat="server" ID="ttt" Enabled="true">
                        </asp:Timer>
                        <asp:Button runat="server" ID="BtnUpdateMessage" Visible="false" Text="AGGIORNA" Style="font-size: 18px; border: 3px solid #FF0000;" />

                        <asp:GridView ID="GridMessage" runat="server" ShowHeader="true" CssClass="summary-results" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="True" Width="100%">
                            <Columns>
                                <asp:TemplateField HeaderText="Conversations">
                                    <ItemTemplate>
                                        <asp:Panel runat="server" ViewStateMode="Disabled">
                                            <table border="0" style="display:block; width: 100%; padding-left: <%# Eval("post.PostLevel") * 30%>px; border-top: <%# iif(eval("post.PostLevel")=0,2,0) %>px solid #fed217;">
                                                <tr>
                                                    <td style="width: 48px;">
                                                        <asp:HyperLink runat="server" NavigateUrl='<%# eval("acc.url") %>' Target="_blank">
                                                            <img src="<%# eval("acc.avatar") %>" />
                                                        </asp:HyperLink>
                                                    </td>
                                                    <td valign="top">
                                                        <asp:HyperLink runat="server" NavigateUrl='<%# "https://twitter.com/" & eval("acc.username") %>' Target="_blank">
                                                            <b>@<asp:Label runat="server" Text='<%# eval("acc.username") %>'></asp:Label></b>
                                                        </asp:HyperLink>
                                                        <div style="font-size: 11px; color: #555555; float: right; padding: 5px;">
                                                            <asp:Label runat="server" Text='<%# MyUI.Print.TimeNow(Eval("post.pubb_date"))%>'></asp:Label>
                                                        </div>
                                                        <div>
                                                            <div style="font-size: 11px;">
                                                                <asp:Label runat="server" Text='<%# MyUI.Print .Post (  eval("post.Post_Text")) %>'></asp:Label>
                                                            </div>
                                                            <%--<asp:Label runat="server" Font-Size="12px" Text='<%# eval("post.Post_Text") %>'></asp:Label>--%>
                                                        </div>
                                                        <asp:UpdatePanel ID="UpPElaborations" ViewStateMode="Enabled" runat="server" UpdateMode="Conditional">
                                                            <ContentTemplate>
                                                                <div>
                                                                    <asp:LinkButton runat="server" ID="LBtShare" Text="Share" ClientIDMode="AutoID" CommandName="SHARE" CommandArgument='<%# eval("post.post_code") %>' />
                                                                    <asp:LinkButton runat="server" ID="LBtReply" Text="Reply" OnClientClick="SetUI(this);" ClientIDMode="AutoID" CommandName="REPLY" CommandArgument='<%# SF("{0},{1}", Eval("post.post_code"), Eval("acc.username"))%>' />
                                                                </div>
                                                                <%-- 
                                                        <asp:Panel runat="server" ID="PnlPost" Visible="false">
                                                            <asp:HiddenField runat="server" ID="HidAccount" Value='<%# eval("acc.username") %>' />
                                                            <asp:TextBox runat="server" ID="TxtPost" TextMode="MultiLine" Rows="3" Width="300"></asp:TextBox>
                                                            <asp:Button runat="server" ID="BtnReply" Text="REPLY" CommandName="SEND_REPLY" CommandArgument='<%# eval("post.post_code") %>' />
                                                        </asp:Panel>--%>
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>
                                                    </td>
                                                </tr>
                                            </table>
                                        </asp:Panel>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <AlternatingRowStyle CssClass="AlternatingRow Padding2" />
                            <HeaderStyle CssClass="Header" />
                            <RowStyle CssClass="Row Padding2" />
                        </asp:GridView>
                        <asp:GridView ID="GridSharePosts" ViewStateMode="Disabled" runat="server" ShowHeader="true" CssClass="summary-results" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="True" Width="100%">
                            <Columns>
                                <asp:TemplateField HeaderText="Share">
                                    <ItemTemplate>
                                        <div style="border-top: 2px solid #fed217;">
                                            <i style="">
                                                <asp:Label runat="server" ForeColor="Red" Text='<%# myui.print.TimeNow(eval("share_date").value) %>'></asp:Label>
                                                <%--                                    <b>(<asp:Label runat="server" Text='<%# ( eval("share_count")) %>'></asp:Label>)</b>--%>
                                            </i>
                                            <div style="font-size: 11px;">
                                                <asp:Label runat="server" Text='<%# MyUI.Print .Post (eval("Post_Text")) %>'></asp:Label>
                                            </div>
                                            <asp:GridView ID="GridShareAccounts" Visible="true" BorderWidth="0" PageSize="5" DataSource='<%# Me.Getddd (eval("hash_id")) %>' Font-Size="10px" runat="server" Width="100%" AutoGenerateColumns="False" CssClass="stable_result_light" ShowHeader="false" AllowSorting="true" AllowPaging="True">
                                                <Columns>
                                                    <asp:TemplateField HeaderText="post" ItemStyle-Width="25px">
                                                        <ItemTemplate>
                                                            <asp:HyperLink runat="server" NavigateUrl='<%# eval("url") %>' Target="_blank">
                                                    <img src="<%# eval("avatar") %>" width="24" />
                                                            </asp:HyperLink>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="Post" ItemStyle-VerticalAlign="Top" HeaderStyle-Width="">
                                                        <ItemTemplate>
                                                            <asp:HyperLink runat="server" NavigateUrl='<%# "https://twitter.com/" & eval("username") %>' Target="_blank">
                                                    <b>@<asp:Label runat="server" Text='<%# eval("username") %>'></asp:Label></b>
                                                            </asp:HyperLink>
                                                            <div style="font-size: 11px;">
                                                                <asp:Label runat="server" Text='<%# myui.print.TimeNow(eval("pubb_date").value)%>'></asp:Label>
                                                            </div>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                                <AlternatingRowStyle CssClass="AlternatingRow Padding2" />
                                                <HeaderStyle CssClass="Header" />
                                                <EditRowStyle CssClass="EditRow" />
                                                <SelectedRowStyle CssClass="SelectedRow" />
                                                <RowStyle CssClass="Row Padding2" />
                                            </asp:GridView>
                                        </div>
                                        <%--<asp:Label runat="server" Text='<%# eval("Post_Text") %>'></asp:Label>--%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <AlternatingRowStyle CssClass="AlternatingRow Padding2" />
                            <HeaderStyle CssClass="Header" />
                            <RowStyle CssClass="Row Padding2" />
                        </asp:GridView>
                        <asp:GridView ID="GridUsers" ViewStateMode="Disabled" runat="server" CssClass="summary-results" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="True" Width="100%">
                            <Columns>
                                <asp:TemplateField HeaderText="Post" ItemStyle-VerticalAlign="Top" HeaderStyle-Width="">
                                    <ItemTemplate>
                                        <div style="font-size: 11px; color: #555555; float: right; padding: 5px;">
                                            <asp:Label runat="server" Text='<%# myui.print.TimeNow(eval("pubb_date")) %>'></asp:Label>
                                        </div>

                                        <asp:HyperLink runat="server" NavigateUrl='<%# "https://twitter.com/" & eval("account_username") %>' Target="_blank">
                                    <b>@<asp:Label runat="server" Text='<%# eval("account_username") %>'></asp:Label></b>
                                        </asp:HyperLink>
                                        foll:    
                                        <asp:Label runat="server" Text='<%# UI.Print.Num0(eval("account_follower_count")) %>'></asp:Label>

                                        <div style="font-size: 11px;">
                                            f
                                    <asp:Label runat="server" Text='<%# MyUI.Print .Post (eval("post_text")) %>'></asp:Label>
                                        </div>



                                        <asp:UpdatePanel ID="UpPElaborations" runat="server" UpdateMode="Conditional">
                                            <ContentTemplate>
                                                <asp:Button runat="server" class="button_follow" ID="BtnFollow" CommandArgument='<%# eval("account_code") %>' CommandName="FOLLOW" Text="FOLLOW" />
                                                <div>
                                                    <asp:Label runat="server" ID="LblFollower"></asp:Label>
                                                </div>
                                            </ContentTemplate>
                                        </asp:UpdatePanel>

                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <AlternatingRowStyle CssClass="AlternatingRow Padding5" />
                            <HeaderStyle CssClass="Header" />
                            <RowStyle CssClass="Row Padding5" />
                        </asp:GridView>

                        <asp:Panel runat="server" ID="PnlPrivateOrder">
                            <asp:LinkButton runat="server" CssClass="days" ID="Rbt1" Text="all" CommandName="GROUP_PRIVATE" CommandArgument="1" Style="width: 70px;" />
                            |
                            <asp:LinkButton runat="server" CssClass="days" ID="Rbt2" Text="sent" CommandName="GROUP_PRIVATE" CommandArgument="2" Style="width: 70px;" />
                            |
                            <asp:LinkButton runat="server" CssClass="days" ID="Rbt3" Text="recived" CommandName="GROUP_PRIVATE" CommandArgument="3" Style="width: 70px;" />
                        </asp:Panel>
                        <div id="accordion">
                            <asp:Repeater runat="server" ID="RptPrivate" >
                                <ItemTemplate>
                                    <div>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# Eval("url")%>' Target="_blank">
                                            <img src="<%# Eval("avatar")%>" />
                                        </asp:HyperLink>
                                        <b>@<asp:Label runat="server" Text='<%# Eval("username")%>'></asp:Label></b>
                                        (<%# Eval("totmess")%>)
                                        <asp:LinkButton runat="server" ID="open" CommandName="open">open</asp:LinkButton>
                                        <asp:HiddenField runat="server" ID="idaccount" value='<%# Eval("id")%>'  />
                                    </div>
                                    <div>
<%--                                        <asp:Repeater runat="server" DataSource='<%# DB.TAB.Private_Post.REL.Private_Post.ToAccount.BY.Private_Post.Account_Id(CurrAccount.Id, Eval("id")).ToDataTable%>'>--%>
                                        <asp:Repeater runat="server" ID="rptmess" >
                                            <ItemTemplate>
                                                <div>
                                                    <asp:Panel runat="server" Style="width: 600px; text-align: left; margin-top: 5px;" Visible='<%# Eval("is_sent")%>'>

                                                        <div style="float: ; background-color: #eeeeee; padding: 10px; border-radius: 5px;">
                                                            <img src="<%# CurrAccount.Avatar%>" style="width: 24px;" />
                                                            <div style="font-size: 11px; color: #555555; float: right; padding: 5px;">
                                                                <asp:Label runat="server" Text='<%# myui.print.TimeNow(eval("pubb_date").value) %>'></asp:Label>
                                                            </div>
                                                            <asp:Label runat="server" Text='<%# MyUI.Print .Post (eval("post_text")) %>'></asp:Label>
                                                        </div>
                                                    </asp:Panel>
                                                    <asp:Panel Style="width: 600px; text-align: right; margin-top: 5px;" runat="server" Visible='<%# Not CBool(Eval("is_sent"))%>'>
                                                        <div style="float: right; background-color: #ffd800; padding: 10px; border-radius: 5px;">
                                                            <div style="font-size: 11px; color: #555555; float: right; padding: 5px;">
                                                                <asp:Label runat="server" Text='<%# myui.print.TimeNow(eval("pubb_date").value) %>'></asp:Label>
                                                            </div>

                                                            <asp:Label runat="server" Text='<%# MyUI.Print .Post (eval("post_text")) %>'></asp:Label>
                                                            <img src="<%# Eval("avatar")%>" style="width: 24px;" />
                                                        </div>
                                                    </asp:Panel>

                                                </div>
                                                <div style="clear: both;"></div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </div>

                                </ItemTemplate>
                            </asp:Repeater>
                        </div>

                        <asp:GridView ID="GridPrivate" runat="server" CssClass="summary-results" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="True" Width="100%">
                            <Columns>
                                <asp:TemplateField HeaderText="Post" ItemStyle-VerticalAlign="Top" HeaderStyle-Width="">
                                    <ItemTemplate>
                                        <asp:HyperLink runat="server" NavigateUrl='<%# Eval("url")%>' Target="_blank">
                                            <img src="<%# Eval("avatar")%>" />
                                        </asp:HyperLink>
                                        <b>@<asp:Label runat="server" Text='<%# Eval("username")%>'></asp:Label></b>
                                        (<%# Eval("totmess")%>)
                                        <asp:LinkButton runat="server" ID="open" CommandName="open">open</asp:LinkButton>
                                        <asp:HiddenField runat="server" ID="idaccount" value='<%# Eval("id")%>'  />

                                                                            <div>
<%--                                        <asp:Repeater runat="server" DataSource='<%# DB.TAB.Private_Post.REL.Private_Post.ToAccount.BY.Private_Post.Account_Id(CurrAccount.Id, Eval("id")).ToDataTable%>'>--%>
                                        <asp:Repeater runat="server" ID="rptmess" >
                                            <ItemTemplate>
                                                <div>
                                                    <asp:Panel runat="server" Style="width: 600px; text-align: left; margin-top: 5px;" Visible='<%# Eval("is_sent")%>'>

                                                        <div style="float: ; background-color: #eeeeee; padding: 10px; border-radius: 5px;">
                                                            <img src="<%# CurrAccount.Avatar%>" style="width: 24px;" />
                                                            <div style="font-size: 11px; color: #555555; float: right; padding: 5px;">
                                                                <asp:Label runat="server" Text='<%# myui.print.TimeNow(eval("pubb_date").value) %>'></asp:Label>
                                                            </div>
                                                            <asp:Label runat="server" Text='<%# MyUI.Print .Post (eval("post_text")) %>'></asp:Label>
                                                        </div>
                                                    </asp:Panel>
                                                    <asp:Panel Style="width: 600px; text-align: right; margin-top: 5px;" runat="server" Visible='<%# Not CBool(Eval("is_sent"))%>'>
                                                        <div style="float: right; background-color: #ffd800; padding: 10px; border-radius: 5px;">
                                                            <div style="font-size: 11px; color: #555555; float: right; padding: 5px;">
                                                                <asp:Label runat="server" Text='<%# myui.print.TimeNow(eval("pubb_date").value) %>'></asp:Label>
                                                            </div>

                                                            <asp:Label runat="server" Text='<%# MyUI.Print .Post (eval("post_text")) %>'></asp:Label>
                                                            <img src="<%# Eval("avatar")%>" style="width: 24px;" />
                                                        </div>
                                                    </asp:Panel>

                                                </div>
                                                <div style="clear: both;"></div>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </div>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        <PagerTemplate>
                           <%-- <App:GridPager ID="GridPager1" runat="server" />--%>
                        </PagerTemplate>
                        </asp:GridView>

                    </div>
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <%--                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>--%>

    <script type="text/javascript">

        var ff;
        $(function () {

            ff = $("#send_post");


            $('#close_post').click(function () {
                ff.fadeOut();
            });

            //SetUI();
            on_update_panel_server(function () {

                $("#aaccordion").accordion({
                    icons: null, heightStyle: "content"
                });


            });


        });

        function SetUI(o) {

            on_update_panel_server_once(function () {

                ff.hide();
                ff.fadeIn();
                ff.position({ my: "left top", at: "left bottom", of: '#' + o.id });

            });
        }

    </script>

</asp:Content>
